package cn.edu.scau.cmi.ema.domain;


import javax.persistence.*;
import javax.xml.bind.annotation.*;
import java.io.Serializable;

@Entity
@NamedQueries({ @NamedQuery(name = "findAllEvent9lds", query = "select myEvent9ld from Event9ld myEvent9ld"),
		@NamedQuery(name = "findEvent9ldByNumber", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.number = ?1"),
		@NamedQuery(name = "findEvent9ldByNumberContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.number like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByEffect", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.effect = ?1"),
		@NamedQuery(name = "findEvent9ldByEffectContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.effect like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByDiscoverytime", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.discoverytime = ?1"),
		@NamedQuery(name = "findEvent9ldByDiscoverytimeContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.discoverytime like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByUrl", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.url = ?1"),
		@NamedQuery(name = "findEvent9ldByUrlContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.url like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByDiscoveraddress", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.discoveraddress = ?1"),
		@NamedQuery(name = "findEvent9ldByDiscoveraddressContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.discoveraddress like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByName", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.name = ?1"),
		@NamedQuery(name = "findEvent9ldByNameContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.name like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByDescription", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.description = ?1"),
		@NamedQuery(name = "findEvent9ldByDescriptionContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.description like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByFood", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.food = ?1"),
		@NamedQuery(name = "findEvent9ldByFoodContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.food like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByProducer", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.producer = ?1"),
		@NamedQuery(name = "findEvent9ldByProducerContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.producer like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByAdultertype", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.adultertype = ?1"),
		@NamedQuery(name = "findEvent9ldByAdultertypeContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.adultertype like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByFoodbatchfiller", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.foodbatchfiller = ?1"),
		@NamedQuery(name = "findEvent9ldByFoodbatchfillerContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.foodbatchfiller like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldBySourceaddress", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.sourceaddress = ?1"),
		@NamedQuery(name = "findEvent9ldBySourceaddressContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.sourceaddress like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByFoodtype", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.foodtype = ?1"),
		@NamedQuery(name = "findEvent9ldByFoodtypeContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.foodtype like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByHazard", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.hazard = ?1"),
		@NamedQuery(name = "findEvent9ldByHazardContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.hazard like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByAdulterlink", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.adulterlink = ?1"),
		@NamedQuery(name = "findEvent9ldByAdulterlinkContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.adulterlink like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldBySource", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.source = ?1"),
		@NamedQuery(name = "findEvent9ldBySourceContaining", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.source like concat('%',?1,'%')"),
		@NamedQuery(name = "findEvent9ldByImported", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.imported = ?1"),
		@NamedQuery(name = "findEvent9ldByIslocked", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.islocked = ?1"),
		@NamedQuery(name = "findEvent9ldById", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.id = ?1"),
		@NamedQuery(name = "findEvent9ldByPrimaryKey", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.id = ?1 "),
		@NamedQuery(name = "deleteEvent9ldsByIds", query = "delete Event9ld where id in (?1)"),
		@NamedQuery(name = "findEvent9ldsByIds", query = "select myEvent9ld from Event9ld myEvent9ld where myEvent9ld.id in (?1)"),
		@NamedQuery(name = "findEvent9ldByPhyscialPrimaryKey", query = "select myEvent9ld from Event9ld myEvent9ld where  myEvent9ld.number = ?1"),
		@NamedQuery(name = "countEvent9ldsByName", query = "select count(myEvent9ld)  from Event9ld myEvent9ld where myEvent9ld.name like concat('%',?1,'%')") })
@Table(catalog = "ema", name = "event9ld")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "ema/cn/edu/scau/cmi/ema/domain", name = "Event9ld")
@XmlRootElement(namespace = "ema/cn/edu/scau/cmi/ema/domain")

public class Event9ld implements Serializable, Comparable<Event9ld> {

	private static final long serialVersionUID = 1L;

	@Column(name = "id", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@XmlElement
	Integer id;

	@Column(name = "number")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String number;

	@Column(name = "effect")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String effect;

	@Column(name = "discoverytime")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String discoverytime;

	@Column(name = "url")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String url;

	@Column(name = "discoveraddress")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String discoveraddress;

	@Column(name = "name")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String name;

	@Column(name = "description")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String description;

	@Column(name = "food")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String food;

	@Column(name = "producer")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String producer;

	@Column(name = "adultertype")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String adultertype;

	@Column(name = "foodbatchfiller")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String foodbatchfiller;

	@Column(name = "sourceaddress")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String sourceaddress;

	@Column(name = "foodtype")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String foodtype;

	@Column(name = "hazard")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String hazard;

	@Column(name = "adulterlink")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String adulterlink;

	@Column(name = "source")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String source;

	@Column(name = "imported")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Boolean imported;

	@Column(name = "islocked")
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Boolean islocked;

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return this.id;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getNumber() {
		return this.number;
	}

	public void setEffect(String effect) {
		this.effect = effect;
	}

	public String getEffect() {
		return this.effect;
	}

	public void setDiscoverytime(String discoverytime) {
		this.discoverytime = discoverytime;
	}

	public String getDiscoverytime() {
		return this.discoverytime;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUrl() {
		return this.url;
	}

	public void setDiscoveraddress(String discoveraddress) {
		this.discoveraddress = discoveraddress;
	}

	public String getDiscoveraddress() {
		return this.discoveraddress;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return this.name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return this.description;
	}

	public void setFood(String food) {
		this.food = food;
	}

	public String getFood() {
		return this.food;
	}

	public void setProducer(String producer) {
		this.producer = producer;
	}

	public String getProducer() {
		return this.producer;
	}

	public void setAdultertype(String adultertype) {
		this.adultertype = adultertype;
	}

	public String getAdultertype() {
		return this.adultertype;
	}

	public void setFoodbatchfiller(String foodbatchfiller) {
		this.foodbatchfiller = foodbatchfiller;
	}

	public String getFoodbatchfiller() {
		return this.foodbatchfiller;
	}

	public void setSourceaddress(String sourceaddress) {
		this.sourceaddress = sourceaddress;
	}

	public String getSourceaddress() {
		return this.sourceaddress;
	}

	public void setFoodtype(String foodtype) {
		this.foodtype = foodtype;
	}

	public String getFoodtype() {
		return this.foodtype;
	}

	public void setHazard(String hazard) {
		this.hazard = hazard;
	}

	public String getHazard() {
		return this.hazard;
	}

	public void setAdulterlink(String adulterlink) {
		this.adulterlink = adulterlink;
	}

	public String getAdulterlink() {
		return this.adulterlink;
	}

	public void setSource(String source) {
		this.source = source;
	}

	public String getSource() {
		return this.source;
	}

	public void setImported(Boolean imported) {
		this.imported = imported;
	}

	public Boolean getImported() {
		return this.imported;
	}

	public void setIslocked(Boolean islocked) {
		this.islocked = islocked;
	}

	public Boolean getIslocked() {
		return this.islocked;
	}

	public void copy(Event9ld that) {

		setId(that.getId());

		setNumber(that.getNumber());
		setEffect(that.getEffect());
		setDiscoverytime(that.getDiscoverytime());
		setUrl(that.getUrl());
		setDiscoveraddress(that.getDiscoveraddress());
		setName(that.getName());
		setDescription(that.getDescription());
		setFood(that.getFood());
		setProducer(that.getProducer());
		setAdultertype(that.getAdultertype());
		setFoodbatchfiller(that.getFoodbatchfiller());
		setSourceaddress(that.getSourceaddress());
		setFoodtype(that.getFoodtype());
		setHazard(that.getHazard());
		setAdulterlink(that.getAdulterlink());
		setSource(that.getSource());
		setImported(that.getImported());
		setIslocked(that.getIslocked());

	}

	public Event9ld() {

	}

	@Override
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");

		buffer.append("number=[").append(number).append("] ");
		buffer.append("effect=[").append(effect).append("] ");
		buffer.append("discoverytime=[").append(discoverytime).append("] ");
		buffer.append("url=[").append(url).append("] ");
		buffer.append("discoveraddress=[").append(discoveraddress).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("description=[").append(description).append("] ");
		buffer.append("food=[").append(food).append("] ");
		buffer.append("producer=[").append(producer).append("] ");
		buffer.append("adultertype=[").append(adultertype).append("] ");
		buffer.append("foodbatchfiller=[").append(foodbatchfiller).append("] ");
		buffer.append("sourceaddress=[").append(sourceaddress).append("] ");
		buffer.append("foodtype=[").append(foodtype).append("] ");
		buffer.append("hazard=[").append(hazard).append("] ");
		buffer.append("adulterlink=[").append(adulterlink).append("] ");
		buffer.append("source=[").append(source).append("] ");
		buffer.append("imported=[").append(imported).append("] ");
		buffer.append("islocked=[").append(islocked).append("] ");

		return buffer.toString();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Event9ld))
			return false;
		Event9ld comparedEvent9ld = (Event9ld) obj;
		if (!CheckPropertyEqual(this.number, comparedEvent9ld.number)) {
			return false;
		}
		return true;
	}

	public static <T> boolean CheckPropertyEqual(T originProperty, T comparedProperty) {
		// 基本类型经过参数传递后会自动装箱
		String[] className = originProperty.getClass().getName().split("\\.");
		if (className[0].equals("java") && className[1].equals("math")) {
			return ((Comparable) originProperty).compareTo(comparedProperty) == 0 ? true : false;
		} else {
			return originProperty.equals(comparedProperty);
		}
	}

	@Override
	public int compareTo(Event9ld o) {
		if (this.getId() > o.getId()) {
			return 1;
		} else if (this.getId() == o.getId()) {
			return 0;
		} else {
			return -1;
		}

	}
}
